<?php

//$string = '<img style="color:#ccc; font-size=14px;" href="http://baidu.com">百度</img>';
//
//$pattern = '/<img(.*?)style=".*?"(.*?)>/';
//
//$content= preg_replace($pattern, "<img$1$2>", $string);
//
//$pa="/(<img.*?)>/";
//$content = preg_replace($pa, '$1 style="width=100%">',       $content );
//var_dump($content);
//die();
//
//$content ='<img class="rich_pages wxw-img" data-ratio="0.6666667" data-src="https://mmbiz.qpic.cn/mmbiz_jpg/hcbLIN7hvQNY1HeibwEjZmzZjfCxiaV1mJ1cOfJuLHQmRC4H7YErYlIoydsjgJQj9BSBiav9giaQ6ja3s517VMUFYQ/640?wx_fmt=jpeg" data-w="1080" style="vertical-align: middle;width: 536px;box-sizing: border-box;">';
//
////$pa="/(<img.*?)>/";
////$content = preg_replace($pa, '$1 width="100%">',       $content );
//
//
//
//$pa='/(< img.*?)width: \d*px/';
//
//$content = preg_replace($pa, '$1 width: 100%',       $content );
////$pa="/(<img.*?)>/";
////$content = preg_replace($pa, '$1 width="100%">',       $content );
//
//var_dump($content);

$content='<div class="rich_media_content                           autoTypeSetting24psection
                          " id="js_content" style="visibility: visible;" /div>';
//$pa='/(id="js_content".*)visibility: visible;/';
//$content = preg_replace($pa, '$1 width:100%',     $content);


$pa='/(id="js_content".*)/iv>/';
$content = preg_replace($pa, '$1 style="width:100%" /iv>',       $content );
echo $content ;

